package xml;

import java.io.*;
import java.util.*;

import org.jdom.*;
import org.jdom.input.*;


public class OssimXml2TestData {

	public static void main(String arge[]) {
		long lasting = System.currentTimeMillis();
		parserXML("resources/rules_new/alienvault-attacks.xml");
	}
	
	public static void parserXML(String filename) {
		String filePath = filename;

		try {
			SAXBuilder sax = new SAXBuilder();
			Document doc = sax.build(filePath);
			Element el = doc.getRootElement();

			List<Element> directiveList = el.getChildren("directive");

			for (Element el_XmlDirective : directiveList) {

				System.out.println(el_XmlDirective.getAttributeValue("name"));
				
				/*XmlDirective directive = new XmlDirective();
				directive.setId(el_XmlDirective.getAttributeValue("id"));
				directive.setName(el_XmlDirective.getAttributeValue("name"));
				directive.setPriority(el_XmlDirective
						.getAttributeValue("priority"));

				List<Element> ruleList = el_XmlDirective.getChildren("rule");

				Element el_XmlRule = ruleList.get(0);

				directive.setRootrule(parserXmlRule(el_XmlRule, directive.getId(),1,0));

				directive_list.add(directive);
				if (myprint_flag)
					directive.showXmlDirective();// 测试打印

				// 添加计数器
				CountSid countSid = new CountSid(directive.getId());
				countdirective.addDirective(directive.getId(), countSid);
*/
			}

		} catch (Exception e) {

			e.printStackTrace();

		}
	}
	
	
}